﻿using LdtJudge.DataEngine.Data;
using LdtJudge.DataEngine.Model.DataModel.SystemtableModel;
using System;
using System.Collections.Generic;
using System.Text;

namespace LdtDataEngin.ModuleDetail.CaseExtract.FocusDispute
{
    public class SituationExpressAdd
    {
        /// <summary>
        /// 进行情形表述内容获取
        /// </summary>
        private DALSYS_Express_GroupSituation dALSYS_Express_Group;
        /// <summary>
        /// 进行情形组合匹配处理
        /// </summary>
        private DALSYS_Express_MatchSituation dALSYS_Express_Match;

        public SituationExpressAdd()
        {
            dALSYS_Express_Match = new DALSYS_Express_MatchSituation();
            dALSYS_Express_Group = new DALSYS_Express_GroupSituation();
        }

        /// <summary>
        /// 根据所有的情形返回组合情形
        /// </summary>
        /// <param name="IsMatch">是否匹配</param>
        /// <param name="AffirmIdeaResult">认定结果</param>
        /// <param name="AllStituationIDs">情形集合</param>
        /// <returns>组合情形ID</returns>
        public string GetGroupSituationID(int IsMatch, string AffirmIdeaResult, List<string> AllStituationIDs)
        {
            if (AllStituationIDs.Count > 0)
            {
                var modelMatchStiuation = dALSYS_Express_Match.GetModel("", IsMatch, AffirmIdeaResult, AllStituationIDs);
                if (modelMatchStiuation != null)
                {
                    return modelMatchStiuation.MS_ID;
                }
            }
            return string.Empty;

        }

        /// <summary>
        /// 获取当前的表述ID
        /// </summary>
        /// <param name="stituationid"></param>
        /// <param name="IsMatch"></param>
        /// <param name="AffirmIdeaResult"></param>
        /// <param name="AllStituationIDs"></param>
        /// <returns></returns>

        public string GetGroupSituationID(string stituationid, int IsMatch, string AffirmIdeaResult, List<string> AllStituationIDs)
        {
            if (AllStituationIDs != null && AllStituationIDs.Count > 0)
            {
                var modelMatchStiuation = dALSYS_Express_Match.GetModel("", IsMatch, AffirmIdeaResult, AllStituationIDs);
                if (modelMatchStiuation != null)
                {
                    return modelMatchStiuation.MS_ID;
                }
            }
            else
            {
                var modelMatchStiuation = dALSYS_Express_Match.GetModel(stituationid, IsMatch, "", "", AffirmIdeaResult, "");
                if (modelMatchStiuation != null)
                {
                    return modelMatchStiuation.MS_ID;
                }
            }
            return string.Empty;
        }








        /// <summary>
        /// 根据情形组合ID获取表述内容
        /// </summary>
        /// <param name="GroupSituationID">组合情形ID</param>
        /// <returns></returns>
        public string GetGroupExpressID(string GroupSituationID)
        {
            string ExpressWordId = string.Empty;
            //查询对应的默认表述ID
            if (!string.IsNullOrWhiteSpace(GroupSituationID))
            {
                ExpressWordId = dALSYS_Express_Group.GetExpressWordID(GroupSituationID);
            }
            return ExpressWordId;
        }

        public SYS_Express_Word GetGroupExpressIDModel(string GroupSituationID)
        {
            //查询对应的默认表述ID
            if (!string.IsNullOrWhiteSpace(GroupSituationID))
            {
                return dALSYS_Express_Group.GetExpressWordIDModel(GroupSituationID);
            }
            return null;
        }
    }
}
